﻿<phone:PhoneApplicationPage 
    x:Class="VisualStudioAchievements.CompareView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="728" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False"
    xmlns:local="clr-namespace:VisualStudioAchievements">

    <Grid Background="White" x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="270"></RowDefinition>
            <RowDefinition Height="60"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>

        <StackPanel Margin="20" Orientation="Horizontal"  DataContext="{Binding Path=Instance.ComparedNiners,Source={StaticResource LocalBindingPoint}}">
            <StackPanel Width="220" DataContext="{Binding FirstNiner}">
                <Image Margin="0,10,0,0" Height="120" Source="{Binding Avatar}"></Image>
                <TextBlock Margin="0,10,0,0" HorizontalAlignment="Center" Width="Auto" FontSize="{StaticResource PhoneFontSizeMediumLarge}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding Name}" Foreground="Black"></TextBlock>
                <TextBlock Margin="0,10,0,0" HorizontalAlignment="Center" Width="Auto" Text="{Binding Points}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" FontSize="{StaticResource PhoneFontSizeLarge}" TextWrapping="Wrap" Foreground="Gray"></TextBlock>
            </StackPanel>
            <StackPanel Width="220" DataContext="{Binding SecondNiner}">
                <Image Margin="0,10,0,0" Height="120" Source="{Binding Avatar}"></Image>
                <TextBlock Margin="0,10,0,0"  HorizontalAlignment="Center" Width="Auto" FontSize="{StaticResource PhoneFontSizeMediumLarge}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding Name}" Foreground="Black"></TextBlock>
                <TextBlock Margin="0,10,0,0"  HorizontalAlignment="Center" Width="Auto" Text="{Binding Points}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" FontSize="{StaticResource PhoneFontSizeLarge}" TextWrapping="Wrap" Foreground="Gray"></TextBlock>
            </StackPanel>
        </StackPanel>

        <Grid Grid.Row="1" Margin="0,0,0,0" Width="440" Background="{StaticResource PhoneAccentBrush}">
            <Image HorizontalAlignment="Left" Source="Images/achievements.png"></Image>
        </Grid>

        <ListBox Margin="20,20,20,20" Grid.Row="2" ItemsSource="{Binding Path=Instance.ComparedAchievements,Source={StaticResource LocalBindingPoint}}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="0,20,0,0" Orientation="Horizontal" >
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="10"></ColumnDefinition>
                                <ColumnDefinition Width="*"></ColumnDefinition>
                            </Grid.ColumnDefinitions>

                            <Rectangle Fill="{StaticResource PhoneAccentBrush}"></Rectangle>
                            
                            <StackPanel Margin="10,0,0,0" Grid.Column="1" Width="220" DataContext="{Binding FirstAchievement}">
                                <StackPanel Orientation="Horizontal">
                                    <Image Height="64" Source="{Binding Icon}"></Image>
                                    <TextBlock FontWeight="Bold" Margin="20,10,0,0" HorizontalAlignment="Center" Text="{Binding Points}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" FontSize="{StaticResource PhoneFontSizeLarge}" TextWrapping="Wrap" Foreground="Gray"></TextBlock>
                                </StackPanel>
                            
                                <TextBlock TextAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="{Binding FriendlyName}" Foreground="Black"></TextBlock>
                            </StackPanel>
                        </Grid>
                        

                        <StackPanel Margin="10,0,0,0" Grid.Column="1" Width="220" DataContext="{Binding SecondAchievement}">
                            <StackPanel Orientation="Horizontal">
                                <Image Height="64" Source="{Binding Icon}"></Image>
                                <TextBlock FontWeight="Bold" Margin="20,10,0,0" HorizontalAlignment="Center" Text="{Binding Points}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" FontSize="{StaticResource PhoneFontSizeLarge}" TextWrapping="Wrap" Foreground="Gray"></TextBlock>
                            </StackPanel>
                            <TextBlock TextAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="{Binding FriendlyName}" Foreground="Black"></TextBlock>
                        </StackPanel>

                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="btnShare" Click="btnShare_Click"  IconUri="/Images/appbar.share.rest.png" Text="share"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
